package com.lcj.springems.rowmapper;

import com.lcj.springems.entity.Emp;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class EmpRowMapper implements RowMapper {
    @Override
    public Object mapRow(ResultSet rs, int i) throws SQLException {
        Emp emp = new Emp();
        emp.setId(rs.getInt("id"));
        emp.setName(rs.getString("name"));
        emp.setSalary(rs.getDouble("salary"));
        emp.setGender(rs.getString("gender"));
        emp.setEdu(rs.getString("edu"));
        emp.setHobbies(rs.getString("hobbies").split(","));
        return emp;
    }
}
